using System;

using Microsoft.FxCop.Sdk.Introspection;

namespace Tyng.Rules
{
    public static class NamingRuleUtilities
    {
        public static bool IsCamel(string name)
        {
            if (name.Length == 0)
            {
                return true;
            }
            if (!NamingRuleUtilities.HasCasing(name))
            {
                return true;
            }
            for (int num1 = 0; num1 < name.Length; num1++)
            {
                if (name[num1] != '_')
                {
                    return char.IsLower(name[num1]);
                }
            }
            return false;
        }

        public static bool IsPascal(string name)
        {
            if (name.Length != 0)
            {
                if (!NamingRuleUtilities.HasCasing(name))
                {
                    return true;
                }
                string[] textArray1 = RuleUtilities.TokenizeCompoundWord(name);
                if ((textArray1.Length > 0) && RuleUtilities.CasingExceptions.ContainsKey(textArray1[0]))
                {
                    return true;
                }
                for (int num1 = 0; num1 < name.Length; num1++)
                {
                    if (name[num1] != '_')
                    {
                        if (!char.IsUpper(name[num1]))
                        {
                            return false;
                        }
                        break;
                    }
                }
            }
            return true;
        }

        internal static bool HasCasing(string name)
        {
            for (int num1 = 0; num1 < name.Length; num1++)
            {
                char ch1 = name[num1];
                if ((char.IsLetter(ch1) && !char.IsUpper(ch1)) && !char.IsLower(ch1))
                {
                    return false;
                }
            }
            return true;
        }

 

 


    }
}
